﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;
using Service.Interface;
using Dao.Interface;

namespace Service
{
    public class MobileImageService : Service<MobileImage>, IMobileImageService
    {
        /// <summary>
        /// 获取手机图片分页集合
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="pageIndex">页索引</param>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageCount">总页数</param>
        /// <returns></returns>
        public IList<MobileImage> LoadAllMobileImageByPage(int userID, int pageIndex, int pageSize, out int pageCount, bool delete)
        {
            return ((IMobileImageRepository)(this.CurrentRepository)).LoadAllMobileImageByPage(userID, pageIndex, pageSize, out pageCount, delete).ToList();
        }

        /// <summary>
        /// 更新手机图片页是否扔进垃圾箱
        /// </summary>
        /// <param name="mobileimageID">手机页图片ID</param>
        /// <param name="delete">是否删除</param>
        public void UpdateMobileImageMarkDelete(object mobileimageID, bool delete)
        {
            if (mobileimageID == null)
            {
                return;
            }
            MobileImage mobileimage = ((IMobileImageRepository)(this.CurrentRepository)).Get(mobileimageID);
            mobileimage.MarkDelete = delete;
            ((IMobileImageRepository)(this.CurrentRepository)).Update(mobileimage);
        }

        /// <summary>
        /// 获取手机图片页集合
        /// </summary>
        /// <param name="userID">用户ID</param>
        /// <param name="delete">是否删除</param>
        /// <returns></returns>
        public IList<MobileImage> LoadAllMobilePage(object userID, bool delete)
        {
            if (userID == null)
            {
                return null;
            }
            return ((IMobileImageRepository)(this.CurrentRepository)).LoadAllMobilePage(userID, delete);
        }
    }
}
